package com.android.antelopeapp.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;

import com.android.antelopeapp.constant.ApiConfig;

/**
 * Created by phk on 2014/12/18.
 * 用于页面跳转
 */
public class ActivityManager {
    /**
     * 跳转到文章内容页面
     * @param  ACFrom 跳转的启示activity
     * @param  articleId 文章id
     * */
    public static void startReArticleDetailActivity(Activity ACFrom,String articleId){
        Intent intent = new Intent(ACFrom,ReArticleDetailActivity.class);
        intent.putExtra(ApiConfig.RA_ID,articleId);
        ACFrom.startActivity(intent);
    }

    /**
     * 跳转到文章列表页面
     * @param ACFrom 跳转的起始activity
     * @param articleTypeId 文章类别id
     * @param startPos 获取文章的起始下标
     * */
    public static void startReArticleListActivity(Activity ACFrom,String articleTypeId,int startPos){
        Intent intent = new Intent(ACFrom, ReArticleListActivity.class);
        intent.putExtra(ApiConfig.RA_TYPE_ID,articleTypeId);
        intent.putExtra(ApiConfig.RA_START_POS,startPos);
        ACFrom.startActivity(intent);
    }

    /**
     * 跳转到添加标签页面
     *
     * @deprecated bitmap过大页面将不能调整
     * 使用bitmap参数传递图片
     */
    public static void startTagImageActivity(Activity ACFrom, Bitmap bitmap) {
        Intent intent = new Intent(ACFrom, TagImageActivity.class);
        intent.putExtra(UploadBPicActivity.PIC_BITMAP, bitmap);
        ACFrom.startActivity(intent);
    }

    /**
     * 跳转到添加标签页面
     * 使用图片地址传递图片信息
     */
    public static void startTagImageActivity(Activity ACFrom, String picPath) {
        Intent intent = new Intent(ACFrom, TagImageActivity.class);
        intent.putExtra(UploadBPicActivity.PIC_PATH, picPath);
        ACFrom.startActivity(intent);
    }

    /**
     * 跳转到添加标签页面
     */
    public static void startTagImageActivityForResult(Activity ACFrom, int requestCode) {
        Intent intent = new Intent(ACFrom, TagImageActivity.class);
        ACFrom.startActivityForResult(intent, requestCode);
    }

    /**
     * 跳转到发布美图页面
     * */
    public static void startShareBPicActivityForResult(Activity ACFrom, int requestCode,Intent tagData){
        Intent intent = new Intent(ACFrom, ShareBpicActivity.class);
        intent.setData(tagData.getData());
        ACFrom.startActivityForResult(intent, requestCode);
    }
    /**
     * 跳转到选择图片页面
     */
    public static void startChoosePicActivity(Activity ACFrom) {
        Intent intent = new Intent(ACFrom, UploadBPicActivity.class);
        ACFrom.startActivity(intent);
    }
}
